/* Copyright 2009 Sony Mathew, Minneapolis MN. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at  http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */
package com.xsm.muck.gwt.client;

import com.google.gwt.user.client.ui.Panel;
import com.xsm.gwt.remoteevent.client.RemoteEventProxyClient;
import com.xsm.lite.event.EventManager;
import com.xsm.lite.event.EventManagerImpl;

/**
 * A basic Context IoC Binding - client side.
 * 
 * @author Sony Mathew
 */
public class MuckClientBinding implements MuckTestSuiteBorderPanel.Context, MuckTestSuitePanel.Context, 
    MsgPanel.Context, ChatPanel.Context 
{
    //the event manager.
    private EventManager eventManager = new EventManagerImpl();
    
    //just need to instantiate this and forget about it.
    //serializes Remote Events to the server-side.
    private RemoteEventProxyClient remoteProxyClient = new RemoteEventProxyClient(eventManager);
        
    //Just the border panel, contains the MsgPanel that prints messages.
    private MuckTestSuiteBorderPanel borderPanel = new MuckTestSuiteBorderPanel(this);
    
    //Main panel that contains the various tests i.e. sample usages of the various concepts.
    private MuckTestSuitePanel testSuitePanel = new MuckTestSuitePanel(this);    
    
    //listens to events and prints messages contained in them. 
    private MsgPanel msgPanel = new MsgPanel(this);
    
    //fires events with text entered by user.
    private ChatPanel chatPanel = new ChatPanel(this);
    
    public MuckClientBinding build() {
        borderPanel.build();
        testSuitePanel.build();
        msgPanel.build();
        chatPanel.build();
        return this;
    }
    
    public EventManager getEventManager() {
        return eventManager;
    }
    
    public Panel getBorderPanel() {
        return borderPanel;
    }

    public Panel getTestSuitePanel() {
        return testSuitePanel;
    }

    public Panel getMsgPanel() {
        return msgPanel;
    }

    public Panel getChatPanel() {
        return chatPanel;
    }
            
}
